/* threads.h
 * Simple wrappers for Win32 threads, mutexes, etc.
 * Steve Donovan, 1999.
 */

#ifndef __THREADS_H
#define __THREADS_H

typedef void *Handle;
#define NULL 0

int tick_count();
int win_exec(char *prog);
void kill_process(int retcode);

class KernelObject {
protected:
  Handle m_handle;
  bool m_own;
public:
  ~KernelObject();
  int wait();
};
  
class Thread: public KernelObject {
 
 public:
   enum Piority { Lowest, BelowNormal,Normal,AboveNormal,Highest };
   Thread(bool owner = true);
   void piority (Piority p);
   void resume();
   void suspend();
   void kill();
   static void sleep(int msec);
   virtual int execute();
};

typedef Thread *PThread;

class Mutex: public KernelObject {
  public:
   Mutex(char *name=NULL);
   int release();
};


#endif
   